package com.yoouce.patchmng.init;

import com.yoouce.patchmng.bean.RoleInfo;
import com.yoouce.patchmng.bean.UserInfo;

import java.util.HashMap;
import java.util.Map;

/**
 * 系统常量类
 * Created by Scott.Lee on 15-9-28.
 */
public class SystemContants {

    /**
     * 用户标识
     */
    public static final String USER_KEY = "USER_KEY";

    private SystemContants() {
    }

    /**
     * 用户信息信息常量类
     */
    private static Map<String, UserInfo> usersMap = new HashMap<String, UserInfo>();

    /**
     * 权限常量类
     */
    private static Map<String, RoleInfo> rolesMap = new HashMap<String, RoleInfo>();

    /**
     * 系统路径常量
     */
    protected static String SYSTEM_FULL_PATH = "";

    public static String getRealClassPath() {
        return SYSTEM_FULL_PATH + "WEB-INF/classes/";
    }

    public synchronized static void setUsersMap(Map<String, UserInfo> inputMap) {
        SystemContants.usersMap = inputMap;
    }

    public synchronized static void setRolesMap(Map<String, RoleInfo> rolesMap) {
        SystemContants.rolesMap = rolesMap;
    }

    public static Map<String, UserInfo> getUsersMap() {
        return usersMap;
    }

    public static Map<String, RoleInfo> getRolesMap() {
        return rolesMap;
    }
}
